﻿Public Class frmManageLeave
    Private frmParent As frmMain
    Dim validator As PropertyValidator = New PropertyValidator
    Dim payrollManager As New PayrollManager
    Dim empinfo As New EmployeeInfoManager
    Private Sub frmLeaveBR_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.MdiParent = frmMain
        ClearAllFields()
        Try
            Dim empNo As Integer
            Dim leaveList As List(Of Leave) = payrollManager.getAllLeave()
            For Each leave As Leave In leaveList
                Dim item As ListViewItem
                'empNo = empinfo.retrieveEmployeeInfoByEmployeeId(leave.employee_id)
                item = lvwLeave.Items.Add("")
                item.SubItems.Add("")
                item.SubItems.Add(leave.leave_from)
                item.SubItems.Add(leave.leave_to)
                item.SubItems.Add(leave.status)
                item.SubItems.Add(leave.reason)
            Next
            grpLeave.Text = "Total Record(s): " + lvwLeave.Items.Count.ToString()
            validator.resizes(lvwLeave)
        Catch ex As Exception
            MsgBox("Can't load Web page" & vbCrLf & ex.Message)
        End Try
    End Sub
    Public Function ClearAllFields()
        validator.ResetControls(grpLeave)
        grpLeave.Text = "Total Record(s): 0"
        validator.resizes(lvwLeave)
        Clipboard.Clear()
        Return 0
    End Function
End Class